<?php
namespace app\common\model;

use think\Model;
use think\model\concern\SoftDelete;

class Article extends Model
{
	use SoftDelete;
    protected $deleteTime = 'delete_time';
    protected $defaultSoftDelete = 0;
    protected $autoWriteTimestamp = true;
    //获取文章简介
    public static function getArticleSummary()
    {
    	return self::field('title as name,create_time,description,image,id as hash_id')->where('delete_time',0)->order('sort','ASC')->select()->toArray();
    }

    //获取文章简介
    public static function getIndexArticle()
    {
    	return self::field('title as name,create_time,description,image,id as hash_id,view')->order('sort','ASC')->limit(2)->select()->toArray();
    }
    //获取文章详情
    public static function getArticleById($id)
    {
        return self::field('title as name,create_time,description,content,image,id as hash_id')->find($id);
    }


}